<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"  %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>资源上传</title>
		<style type="text/css">
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}

.STYLE1 {
	font-size: 12px
}

.STYLE3 {
	font-size: 12px;
	font-weight: bold;
}

.STYLE4 {
	color: #03515d;
	font-size: 12px;
}

.td_bg {
	font-size: 13px;
	background: #fff;
	border:1px solid #6495ED;
}

/*表单项的字体格式*/
.td_x_bg {
	font-size: 13px;
	font-weight: bold;
	text-align: center;
	background: #BDE3FB;
	border:1px solid #6495ED;
	height:40px;
}

.table {
	margin-top: 10px;
}
</style>
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/checkUtil.js"></script>
	<script>
		function getDocType() {
			var docPath = document.getElementById("upload").value;
			var docName = docPath.substring(docPath.lastIndexOf('\\') + 1,docPath.lastIndexOf('.'));
			document.getElementById('docName').value = docName;
		}
		
		var checkForm = function() {
			
			var upload = $.trim($("#upload").val());
			var docName = $.trim($("#docName").val());
			var description = $.trim($("#description").val());
			
			if(upload == '') {
				alert("请选择一个资源");
				return false;
			}else if(docName == '') {
				alert("请填写资源名称");
				return false;
			}else if(description == '') {
				alert("请填写资源描述!");
				return false;
			}
			
			return true;
		}
	</script>
	</head>

	<body>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td height="30" background="images/main/tab_05.gif">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td width="12" height="30">
								<img src="images/main/tab_03.gif" width="12" height="30" />
							</td>
							<td>
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td width="46%" valign="middle">
											<table width="100%" border="0" cellspacing="0"
												cellpadding="0">
												<tr>
													<td width="5%">
														<div align="center">
															<img src="images/main/tb.gif" width="16" height="16" />
														</div>
													</td>
													<td width="95%" class="STYLE1">
														<span class="STYLE3">你当前的位置</span>：[资源共享]-[上传资源]
													</td>
												</tr>
											</table>
										</td>
										<td width="54%">
											<table border="0" align="right" cellpadding="0"
												cellspacing="0">
												<tr>
													<td width="80">
														<table width="90%" border="0" cellpadding="0"
															cellspacing="0">
															<tr>
																<td>
																	&nbsp;
																</td>
															</tr>
														</table>
													</td>
													<td width="60">
														<table width="90%" border="0" cellpadding="0"
															cellspacing="0">
															<tr>
																<td class="STYLE1"></td>
																<td class="STYLE1"><br></td>
															</tr>
														</table>
													</td>
												</tr>
											</table>
										</td>
									</tr>
								</table>
							</td>
							<td width="16">
								<img src="images/main/tab_07.gif" width="16" height="30" />
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td width="8" background="images/main/tab_12.gif">
								&nbsp;
							</td>
							<td>
								<form action="front/fileUpload.action" method="post" name="form1" enctype="multipart/form-data" onsubmit="return checkForm()" >
								<table class="table" border="1" width="70%" align="center"
									cellpadding="2" cellspacing="2" bordercolor="#6495ED">
									<tbody>
										<tr>
											<td colspan="2" style="border:1px solid #6495ED;background:#BDE3FB;height:40px;padding-left:5px;font-weight:bold;">
												资源上传
											</td>
										</tr>
										<tr>
											<td class="td_bg" width="100" style="text-align:center">
												选择文件
											</td>
											<td class="td_bg" style="height:40px;">
												<input type="file" name="upload" id="upload" onchange="getDocType(this)" size=40 style="height:30px;"/>
											</td>
										</tr>
										<tr>
											<td class="td_bg" width="100" style="text-align:center">
												资源名称
											</td>
											<td class="td_bg" style="height:40px;">
												<input type="text" name="resource.docName" id="docName" size="30">
												<span style="background:url(images/main/star2.gif) 0 -2px no-repeat;padding-left:16px;">此名称为资源上传后显示的名称</span>
											</td>
										</tr>
										<tr>
											<td class="td_bg" width="100" style="text-align:center">
												资源类型
											</td>
											<td class="td_bg" style="height:40px;">
												<input type="radio" name="resource.docGroup" value="0" checked="checked" >兴趣爱好
												<input type="radio" name="resource.docGroup" value="1">Java
												<input type="radio" name="resource.docGroup" value="2">PHP
												<input type="radio" name="resource.docGroup" value="3">LINUX
												<input type="radio" name="resource.docGroup" value="4">数据库
												<input type="radio" name="resource.docGroup" value="5">其它
											</td>
										</tr>
										<tr>
											<td class="td_bg" valign="top" style="padding-top:10px;text-align:center" >
												资源描述
											</td>
											<td class="td_bg">
												<textarea name="resource.description" id="description" rows="10" cols="60"></textarea>
											</td>
										</tr>
										<tr>
											<td class="td_bg" colspan="2" style="padding-left:50px;">
												<input type="hidden" name="resource.uploader.id" value="<s:property value="#session.user.id" />" />
												<input type="submit" value="保存" style="width:80px;height:30px;margin-left:60px;" />
												<input type="reset" value="重置" style="width:80px;height:30px;margin-left:30px;" />
											</td>
										</tr>
									</tbody>
								</table>
								</form>
							</td>
							<td width="8" background="images/main/tab_15.gif">
								&nbsp;
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td height="35" background="images/main/tab_19.gif">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td width="12" height="35">
								<img src="images/main/tab_18.gif" width="12" height="35" />
							</td>
							<td>
								<form action="" method="get">
									<table width="100%" border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td>
												&nbsp;
											</td>
										</tr>
									</table>
								</form>
							</td>
							<td width="16">
								<img src="images/main/tab_20.gif" width="16" height="35" />
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</body>
</html>
